package com.ChenYaRou.www.controller.servlet;

import com.ChenYaRou.www.controller.RegisterServletController;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * 注册时 当用户在用户名一栏 失去焦点后 在后端判断username是否存在，存在则返回信息提示
 * @ClassName RegisterServlet
 * @Description TODO
 * @Author 86183
 * @Date 2022/4/30 0:53
 * @Version 1.0
 **/
public class RegisterServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        RegisterServletController registerServlet=new RegisterServletController();
        PrintWriter out = resp.getWriter();
        out.write(registerServlet.register(req.getParameter("userName")));
        out.flush();
        out.close();
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}
